package twentytwentyone_3;

import java.util.PriorityQueue;

/**
 * @Author: Zahi
 * @Description:
 * @Date Created in 2021-03-24 16:01
 * @Modified By:
 */
public class KthLargest_703 {


    static int[] a={4,5,8,2,3,5,10,9,4};


    public static void main(String[] args){
        PriorityQueue<Integer> pq = new PriorityQueue<Integer>();
        for (int i : a) {
            pq.offer(i);
            if (pq.size() > 3) {
                pq.poll();
                System.out.println(pq.peek());
            }
        }
    }
}
